import request from '@/utils/request'

const baseUrl = '/apartment/bill'

/* 获取账单列表 */
export function getList(data) {
    return request({
        url: baseUrl + '/list',
        method: 'get',
        params: data
    })
}

/* 房间汇总账单列表 */
export function getRoomSummaryList(data) {
    return request({
        url: baseUrl + '/room-summary-list',
        method: 'get',
        params: data
    })
}

/* 新增账单 */
export function save(data) {
    return request({
        url: baseUrl,
        method: 'post',
        data: data
    })
}

/* 批量新增账单 */
export function batchSave(data) {
    return request({
        url: baseUrl + '/batchAdd',
        method: 'post',
        data: data
    })
}

/* 更新账单 */
export function update(data) {
    return request({
        url: baseUrl,
        method: 'put',
        data: data
    })
}

/* 删除账单 */
export function remove(billIds) {
    return request({
        url: `${baseUrl}/${billIds}`,
        method: 'delete',
    })
}

/* 金额统计 */
export function amountTotal(status) {
    return request({
        url: `${baseUrl}/amount-total`,
        method: 'get',
        params: { status }
    })
}

/* 获取待提现金额 */
export function getUnwithdrawAmount(apartmentId) {
    return request({
        url: `${baseUrl}/unwithdraw-amount`,
        method: 'get',
        params: { apartmentId }
    })
}

export default {
    getList,
    getRoomSummaryList,
    save,
    batchSave,
    update,
    remove,
    amountTotal,
    getUnwithdrawAmount
}